package com.mach.platform.api.repository;

import com.mach.platform.api.domain.ReadMessage;
import com.mach.platform.repository.BaseRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ReadMessageRepo extends BaseRepository<ReadMessage> {

    /**
     * 通过openId和消息id查询数据
     * @param openId
     * @param messageIds
     * @return
     */
    @Query(value = "select * from read_message where open_id = ?1 and message_id in (?2)", nativeQuery = true)
    List<ReadMessage> findByOpenIdMessageIds(String openId, List<Long> messageIds);

}
